<!--决算页面-->
<template>
    <view class="account-page" ref="myContent" id="zrJueSuanInfo">
        <FinalAccounts :prjId="attachMentInfo.prjId" v-if="prjType==='M'"/>
        <FinalAccountsA :prjId="attachMentInfo.prjId" v-if="prjType!=='M'"/>
        <FinalAccountsB :prjId="attachMentInfo.prjId" v-if="prjType!=='M'"/>
        <AttachMentInfo :attachMentObj="attachMentInfo" />
        <jn-approval-detail :processInstID="attachMentInfo.processInstId" :prj-type="attachMentInfo.prjType"></jn-approval-detail>
    </view>
</template>

<script>
import FinalAccounts from "@/inspur/accounts/components/finalAccounts.vue"
import FinalAccountsA from "@/inspur/accounts/components/finalAccountsA.vue"
import FinalAccountsB from "@/inspur/accounts/components/finalAccountsB.vue"
import AttachMentInfo from "@/inspur/attachmentinfo/index.vue"
import JnApprovalDetail from "@/component/jn/JnApprovalDetail.vue";
export default {
    name: "Accounts",
    components: {
        FinalAccounts,
        AttachMentInfo,
        JnApprovalDetail,
        FinalAccountsA,
        FinalAccountsB
    },
    data() {
        return {
            btnList: [
                {
                    label: "保存",
                    method: "save",
                },
                {
                    label: "回退",
                    method: "back",
                }
            ],
            // 附件需要的参数  综合查询
            attachMentInfo: {
            },
            prjType:''
        }
    },
    //监听页面加载
    onLoad(option) {
        this.attachMentInfo = option
        uni.setStorageSync("sysToken", option.sysToken)
        uni.setNavigationBarTitle({
            title: '决算编制'
        });
        this.getProjectType();
    },
    methods:{
        getProjectType(){
            this.$axios.get('/settlement/api/adjustment/queryPrjInfo?prjId='+this.attachMentInfo.prjId).then((res)=>{
                this.prjType = res.data.prjType;
            })
        }
    },
    mounted() {
        // 监听高度变化
        const div = document.querySelector('#zrJueSuanInfo');
        const url=window.location.protocol+'//'+window.location.host;
        // 创建一个ResizeObserver实例，并提供一个回调函数
        const resizeObserver = new ResizeObserver(entries => {
            for (let entry of entries) {
                const { height } = entry.contentRect;
                console.log(height, '决算编制发送高度')
                window.parent.postMessage({ type: 'jueSuanHeight', height: height }, url)
            }
        });
        resizeObserver.observe(div)
    }
}
</script>

<style>
@import "@/common/common-ui.css";
</style>
<style scoped lang="scss">
.account-page {
    padding: 20rpx 20rpx 160rpx;
}
</style>